package IO流02.字节流复制;

import java.io.*;

//一次读一个字节
public class CopytxDemo {
    public static void main(String[] args)throws IOException {
        //根据数据源创建字节输入对象
        FileInputStream fis = new FileInputStream("D:\\qq文件\\宿舍.txt");
        BufferedInputStream bis = new BufferedInputStream(fis);
        //根据目的地创建字节输出流对象
        FileOutputStream fos = new FileOutputStream("D:\\Idea\\IO流02\\宿舍2.txt");
        //字节缓存流
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        int by;
        while ((by=bis.read())!=-1){
        bos.write(by);
        }
//        fis.close();
//        fos.close();
        bos.close();
        bis.close();
        fis.close();
        fos.close();
    }
}
